<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作品页</title>
</head>
<body>
    <div id="artwork-id"></div>
    <div id="img-wrapper"></div>
    <div id="info"></div>
    <div id="creator"></div>
</body>
</html>
<script>
    fetch('/artwork/p/get-data',{credentials:"include"}).then(res=>{
        return res.json()
    }).then(json=>{
        document.querySelector('#artwork-id').innerText = json['artwork_ID']
        document.querySelector('#info').innerHTML = json['content']

        fetch('/user/profile/avatar/'+json['UID'],{credentials:"include"}).then(res=>{
            return res.blob()
        }).then(blob=>{
            let img = document.createElement('img')
            img.setAttribute('src',URL.createObjectURL(blob))
            document.querySelector('#creator').appendChild(img)
        })

        fetch(json['artwork_url'],{credentials:"include"}).then(res=>{
            return res.blob()
        }).then(blob=>{
            let img = document.createElement('img')
            img.setAttribute('src',URL.createObjectURL(blob))
            document.querySelector('#img-wrapper').appendChild(img)
        })
    })
</script>